﻿<%@ page language="java" pageEncoding="utf-8" %>
<%@page contentType ="text/html; charset=utf-8" %>

<%request.setCharacterEncoding("UTF-8");%>
<!DOCTYPE html>
<html  lang="en">
<head>
<meta charset="utf-8">
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<link rel="shortcut icon" href="../images/apple.ico" type="image/x-icon"/>
<title>用户主页</title>
<!--Main Stylesheet-->
<link rel="stylesheet" href="http://apps.bdimg.com/libs/bootstrap/3.3.0/css/bootstrap.min.css">  
<script src="http://apps.bdimg.com/libs/jquery/2.1.1/jquery.min.js"></script>
<script src="http://apps.bdimg.com/libs/bootstrap/3.3.0/js/bootstrap.min.js"></script>
<style rel="stylesheet"type="text/css">
.col-md-3,.col-md-9{
margin:0;
padding:0;
}
#mypb{
 background-color:rgb(3, 245, 242);
}

#myInfo{border:white solid 1px;border-radius:0;}

tr{border:0;}
</style>
</head>
<body>

<script type="text/javascript">
$(
function(){
var h=$(window).height();
$('#left').css("height",h);
}
);

//左边栏隐藏
$(window).resize(function(){
	var wid=document.body.clientWidth;
	if(wid<1000){

		$('#left').css("display","none");
	}else{
		$('#left').css("display","block");
	}
});

</script>
<!--left-->
<div class="col-md-3" id="left" style="background:url(../images/20150808.jpg) no-repeat 0 0;position:fixed;z-index:100;border-right:white 1px solid">
<p style="color:white;">欢迎“<%=session.getAttribute("uname")%>”登录到您的个人主页！</p>
<div class="col-md-10">
<div class="panel panel-primary" id="myInfo">

</div>
</div>

<script type="text/javascript">
$(function(){
	
	 $.ajax({
                 type: "GET",
                 url: "getUserInfo.jsp",        
                 success: function(data) {
					 $('#myInfo').html(data);
                 },
                 error: function(data) {
                     alert(data);
                 }
             })
			 });


</script>

</div>

<!--right-->
<div class="col-md-9 col-md-offset-3" style="margin-top:20px;margin-bottom:30px;">

<div class="col-md-10 col-md-offset-5">
<div class="panel panel-default"style="border:white 1px solid;border-radius:0;">
<div class="panel-body"style="background-color:rgb(3, 245, 242);">
<form role="form" id="myPublish">
<textarea class="form-control" name="message" id="message" rows="10"overflow="scroll"style="background-color:rgba(255,255,255,0.8);border:white 1px solid;">我想发布的消息</textarea>
<button class="btn btn-default" id="confirm" type="button" style="margin-top:20px;float:right;background-color:rgba(255,255,255,0.8);border:white 1px solid;border-radius:0;">提交</button>
</form>
</div>
</div>
<script>
$(function(){
	$("#confirm").click(function(){
		if($('#message').val()==""||$('#message').val()=="我想发布的消息"){
			alert("请输入您想要发布的消息！！！");
		}else{
			
             $.ajax({
                 type: "post",
                 url: "leaveMsg.jsp",     
                 data: $("#myPublish").serialize(),    
                 success: function() {
					 window.location.href=window.location.href;
                 }
             });
		}
		
		
         });
		 
		 $('#message').focus(
                        function(){
                          var m_txt=$(this).val();
                        if(m_txt=="我想发布的消息"){
                    	$(this).val("");
                                     }

                      $(this).css({"border":"white 1px solid","box-shadow":"0 0 2px 2px #fff","-moz-box-shadow":"0 0 2px 2px #fff","-webkit-box-shadow":"0 0 2px 2px #fff"});
                              }
                              );


               $('#message').blur(
                 function(){
                 var m_txt=$(this).val();
                    if(m_txt==""){
	                $(this).val("我想发布的消息");
                        }

                       $(this).css({"box-shadow":"0 0 0 0 #fff","-moz-box-shadow":"0 0 0 0 #fff","-webkit-box-shadow":"0 0 0 0 #fff"});
                    }
                    );
            	});


</script>

<div class="panel panel-default"style="background-color:rgb(3, 245, 242);border:white 1px solid;border-radius:0;">
<div class="panel-heading" style="background-color:rgba(255,255,255,0.8);font-family:'Microsoft YaHei','Hiragino Sans GB',Helvetica,Arial,'Lucida Grande',sans-serif;font-weight:bold;border:white 1px solid;">
<h3 class="panel-title">
我发布过的消息
</h3>
</div>
<div class="panel-body" id="mypb">

</div>
</div>

<script>
$(function(){
	
	$.ajax({
		type:"GET",
		url:"myPb.jsp",
		success:function(data,textStatus){
			$("#mypb").html(data);
			
			//alert(data);
		}
	});
	

});
</script>
</div>

</div>

<div id="footer" style="position:fixed;bottom:0;background-color:black;width:100%;z-index:1000;">
    <div class="col-md-4 col-md-offset-4"style="color:white;">Copyright &copy; Rita.&nbsp; All Rights Reserved.</div>
</div> 
</body>
</html>